Carbon


CanDocBeOpened

Header: Translation.h Carbon status: Supported

Determines whether a specified application can open a particular document.

OSErr CanDocBeOpened (
    const FSSpec *targetDocument, 
    SInt16 appVRefNumHint, 
    OSType appSignature, 
    const FileType *nativeTypes, 
    Boolean onlyNative, 
    DocOpenMethod *howToOpen, 
    FileTranslationSpec *howToTranslate
);
Parameter descriptions
targetDocument

A pointer to the document to check

appVRefNumHint

The volume reference number of the volume containing the application. The search for the specified application begins on this volume; if the application isn’t found there, the search continues to other mounted volumes.

appSignature

The signature of the application.

nativeTypes

A pointer to the zero-terminated list of file types that the application can open without translation; if this parameter contains NULL, the default list of file types returned by the GetFileTypesThatAppCanNativelyOpen function is used.

onlyNative

If TRUE, determine only whether the application can open the document without translation; otherwise, determine whether the application can open the document after translation.

howToOpen

On return, a pointer to a constant indicating the method of opening the document. This field contains a meaningful value only if the function returns noErr (indicating that the specified document can be opened). See “DocOpenMethod Constants” for a description of the values you can use here.

howToTranslate

On return, if the document needs to be translated before it can be opened, a pointer to a buffer of information (in a private format) indicating how to translate the document. You pass the information returned in this parameter to the TranslateFile function.

function result

A result code. If the application can open the document, the function returns noErr.

DISCUSSION

A preference must have already been set (using the Document Converter tool) on how to open the document.

SPECIAL CONSIDERATIONS

This function might cause memory to be moved or purged; you should not call it at interrupt time.

AVAILABILITY

Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.


© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)